//
//  LKMessageViewController.m
//  LKIntelligentVideoProject
//
//  Created by she1323 on 2018/9/20.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKMessageViewController.h"
#import "LKMapViewController.h"
#import "LKMessageListViewController.h"
#import <JXCategoryView/JXCategoryView.h>
@interface LKMessageViewController ()

@property (nonatomic, strong) NSArray *titles;
@property (nonatomic, strong) JXCategoryTitleView *myCategoryView;
@end

@implementation LKMessageViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    self.tabBarController.tabBar.hidden = NO;
    [self.navigationController.navigationBar setBarTintColor:[UIColor whiteColor]];
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
//    self.tabBarController.tabBar.hidden = YES;
//     [self.navigationController.navigationBar setBarTintColor:ColorRGB(45, 50, 72)];
}
-(void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
//    [self.navigationController.navigationBar setBarTintColor:ColorRGB(45, 50, 72)];
}
- (void)viewDidLoad {
    _titles = @[@"井盖",@"门禁",@"监控"];
    [super viewDidLoad];
    self.navigationItem.title = @"信息";
    [self setSegmentView];
    // Do any additional setup after loading the view.
}
-(void)setSegmentView{
    self.categoryView.frame = CGRectMake(0, 0, 183, 30);
//    self.categoryView.contentScrollView.scrollEnabled = NO;
    self.myCategoryView.cellWidth = 60;
    self.myCategoryView.titleFont = [UIFont systemFontOfSize:17];
    self.myCategoryView.titles = self.titles;
    self.myCategoryView.titleColor = [UIColor grayColor];
    self.myCategoryView.titleSelectedColor = [UIColor blackColor];
    self.myCategoryView.cellSpacing = 1;
//    self.myCategoryView.delegate = self;
    JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
    lineView.indicatorLineViewColor = [UIColor orangeColor];
    lineView.indicatorLineWidth = 30;
    lineView.indicatorLineViewHeight = 1;
    self.myCategoryView.indicators = @[lineView];
    
    [self.myCategoryView removeFromSuperview];
    self.navigationItem.titleView = self.myCategoryView;
}
- (JXCategoryTitleView *)myCategoryView {
    return (JXCategoryTitleView *)self.categoryView;
}

- (NSUInteger)preferredListViewCount {
    return self.titles.count;
}

- (Class)preferredCategoryViewClass {
    return [JXCategoryTitleView class];
}
-(Class)preferredListViewControllerClass{
    
    return [LKMessageListViewController class];
}

- (CGFloat)preferredCategoryViewHeight {
    return 0;
}

-(void)configListViewController:(UIViewController *)controller index:(NSUInteger)index{
    
    if (index == 0) {
        LKMessageListViewController *vc = (LKMessageListViewController *)controller;
        vc.unitType = NSUniTypeCover;
    }else if(index == 1){
        LKMessageListViewController *vc = (LKMessageListViewController *)controller;
        vc.unitType = NSUniTypeGuard;
    }else{
        LKMessageListViewController *vc = (LKMessageListViewController *)controller;
        vc.unitType = NSUniTypeVideo;
    }
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
